package cn.edu.xmu.orderpayment.order.microservice.service;

import cn.edu.xmu.orderpayment.order.microservice.retvo.OnSaleRetVo;
import cn.edu.xmu.orderpayment.order.microservice.retvo.ProductRetVo;
import cn.edu.xmu.orderpayment.order.microservice.vo.QuantityVo;
import cn.edu.xmu.privilegegateway.annotation.util.InternalReturnObject;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * @author Yujie Lin
 * @date 2021/12/9 10:58
 */
@FeignClient("goods-service")
public interface GoodsService {

    @GetMapping("internal/onsales/{id}")
    InternalReturnObject<OnSaleRetVo> getOnSaleById(@PathVariable Long id);

    @GetMapping("internal/products/{id}/detail")
    InternalReturnObject<ProductRetVo> getProductById(@PathVariable Long id);

    @PutMapping("internal/onsales/{id}/decr")
    InternalReturnObject decreaseOnSale(@PathVariable Long id, @RequestBody QuantityVo quantity);


    @PutMapping("internal/onsales/{id}/incr")
    InternalReturnObject advanceIncrQuantity(@PathVariable Long id, @RequestBody QuantityVo quantity);

    @PutMapping("internal/onsales/{id}/realDecr")
    InternalReturnObject decrQuantity(@PathVariable Long id, @RequestBody QuantityVo quantity);


    @PutMapping("internal/onsales/{id}/realIncr")
    InternalReturnObject incrQuantity(@PathVariable Long id, @RequestBody QuantityVo quantity);



}
